package com.mlxg.master.controller;/**
 * @author zcy
 * @date 2025/5/19 17:48
 */

import com.mlxg.master.service.HzExhibitorSourceService;
import com.mlxg.master.service.HzExhibitsReceiveService;
import com.mlxg.master.service.IHzProductSeriesService;
import com.mlxg.selver.domain.IdMapping;
import com.mlxg.selver.service.IIdMappingService;
import com.mlxg.untils.oss.GeneralOSSUpLoadUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

/**
 * @author zcy
 * @date 2025/5/19 17:48
 * @description: 测试
 */
@RestController
@RequestMapping("/zh")
public class HzExhibitorController {
    @Autowired
    private HzExhibitorSourceService hzExhibitorSourceService;

    @Autowired
    private IIdMappingService iIdMappingService;

    @Autowired
    private GeneralOSSUpLoadUtils generalOSSUpLoadUtils;

    @Autowired
    private IHzProductSeriesService hzProductSeriesService;

    /**
     * 展品
     */
    @Autowired
    private HzExhibitsReceiveService hzExhibitsReceiveService;

    @GetMapping
    public String getOne() {
        hzExhibitorSourceService.generateIdMapping();
        return "ok";
    }


    /**
     * 自定义展品迁移
     * @return
     */
    @GetMapping("productSeries")
    public String transferProductSeries() {
        hzProductSeriesService.transferProductSeries();
        return "ok";
    }

    /**
     * 展品数据迁移
     * @return
     */
    @GetMapping("hzProduct")
    public String transferHzProduct() {
        hzExhibitsReceiveService.transferHzExhibits();
        return "ok";
    }

    @GetMapping("file")
    public String file(String source ,String type) {
        String s=null;
        try {
             s = generalOSSUpLoadUtils.uploadUrlToOss(source, type);
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }
}
